<template>
    <cfg-form-list slot="right">
        <cfg-title v-bind="config.title"></cfg-title>
        <cfg-form :only-read="onlyRead" v-bind="config.section.start" :data="data"></cfg-form>
        <cfg-subtitle :title="'相关数据:'"></cfg-subtitle>
        <cfg-form :only-read="onlyRead" style="border:1px solid #dcdee2;padding-top: 10px;" v-bind="config.section.relateData" :data="data.relateData"></cfg-form>
        <cfg-subtitle :title="'记录:'"></cfg-subtitle>
        <cfg-sheet :onlyRead="onlyRead" v-bind="config.section.records" :data="data.records"></cfg-sheet>
        <Button type="primary" long @click="data.records.push({})">加一行</Button>
        <cfg-subtitle :title="'备注:'"></cfg-subtitle>
        <cfg-form :onlyRead="onlyRead" style="border:1px solid #dcdee2;padding-top: 10px;" v-bind="config.section.comments" :data="data.comments"></cfg-form>
        <cfg-form :only-read="onlyRead" style="margin-top:10px;" v-bind="config.section.end" :data="data"></cfg-form>
    </cfg-form-list>
</template>

<script>
    export default {
        data () {
            return {
                onlyRead: false,
                config: {
                    title: {
                        title: '配 碳 生 产 通 知 书',
                        titleStyle: {},
                        outlineStyle: { marginBottom: '20px' }
                    },
                    section: {
                        start: {
                            labelWidth: 70,
                            labelPosition: 'right',
                            columns: [
                                { title: '表单号:', key: 'formNo', config: { type: 'text' } },
                                { title: '流水号:', key: 'No', config: { type: 'text' } }
                            ],
                            cols: 2,
                            rules: {}
                        },
                        relateData: {
                            labelWidth: 100,
                            labelPosition: 'right',
                            columns: [
                                { title: '炉料:', key: 'burden', config: { type: 'text' } },
                                { title: '批次:', key: 'batchNo', config: { type: 'text' } },
                                { title: 'C要求（%）:', key: 'carbon', config: { type: 'number' } }
                            ],
                            cols: 3,
                            rules: {}
                        },
                        records: {
                            columns: [
                                { title: 'W      粉',
                                  align: 'center',
                                  children: [
                                      { title: '日期', align: 'center', key: 'date', config: { type: 'date' } },
                                      { title: '批次', align: 'center', key: 'batchNo', config: { type: 'text' } },
                                      { title: '重量', align: 'center', key: 'weight', config: { type: 'number' } },
                                      { title: 'FSSS(μm)', align: 'center', key: 'FSSS', config: { type: 'number' } },
                                      { title: 'O<span style="font-size:12px;font-family:YouYuan">2</span>（%）', align: 'center', key: 'oxygen', config: { type: 'number' } },
                                      { title: '理论需求量', align: 'center', key: 'theory', config: { type: 'number' } }
                                  ]
                                },
                                { title: 'C黑种类', align: 'center', key: 'cBatchNo', config: { type: 'text' } }
                            ]
                        },
                        comments: {
                            labelWidth: 100,
                            labelPosition: 'right',
                            cols: 4,
                            columns: [
                                { title: '配碳机:', key: 'equipment', config: { type: 'text' } },
                                { title: '混料时间:', key: 'mixinTime', config: { type: 'text' } },
                                { title: '冷却时间:', key: 'coolTime', config: { type: 'text' } },
                                { title: '混料次数:', key: 'mixinCount', config: { type: 'number' } },
                                { title: '总碳CT:', key: 'ct', config: { type: 'text' } },
                                { title: '费氏FSSS:', key: 'fsss', config: { type: 'text' } }
                            ],
                            rules: {}
                        },
                        end: {
                            labelWidth: 70,
                            labelPosition: 'right',
                            columns: [
                                { title: '通知者:', key: 'notifier', config: { type: 'text' } },
                                { title: '审核:', key: 'auditor', config: { type: 'text' } },
                                { title: '日期:', key: 'date', config: { type: 'date' } }
                            ],
                            cols: 3,
                            rules: {}
                        }
                    }
                }
            };
        },
        props: {
            data: {
                default: () => {
                    return {
                        formNo: 'HM-AH032-A',
                        No: '碳第  xxx  号',
                        relateData: {
                            burden: '',
                            batchNo: '',
                            carbon: 0
                        },
                        records: [
                            {
                                date: '2022-12-06',
                                batchNo: '',
                                weight: 0,
                                FSSS: 0,
                                oxygen: 0,
                                theory: 0,
                                cBatchNo: ''
                            }
                        ],
                        comments: {
                            equipment: '',
                            mixinTime: '',
                            coolTime: '',
                            mixinCount: 0,
                            ct: '',
                            fsss: ''
                        },
                        notifier: '',
                        auditor: '',
                        date: ''
                    }
                }
            }
        }
    };
</script>
<style scoped lang="scss"></style>
